Draws a background made with background_create in the colors of a palette instead of its picture’s own colors. background_palette(bg, nothing) puts the picture’s own colors back.
Works differently on Game Boy - The Game Boy has 4 shades of grey, and the picture shares one palette of them with the letters; sprites have two palettes of 3 shades and clear, so a recolor can only change which of the 4 shades each of the picture's 4 shades shows.
Works differently on Game Boy Color - The Game Boy Color has 8 palettes for sprites and 8 for the picture, each with 4 colors, so a palette of 16 colors recolors the picture by color number, and two colors of a crowded picture can share one.
On other consoles this differs: see Side by side and How the consoles differ.
background_palette(bg, palette)| Name | Type |
|---|---|
bg | background |
palette | palette |
Nothing.
Draws a background made with background_create in the colors of a palette instead of its picture's own colors. background_palette(bg, nothing) puts the picture's own colors back. A no-op on nothing.
The palette has to have 16 colors, and the picture has to be a 16-color one - which every picture you draw for a background in the Paint tab is. A 256-color picture cannot be recolored this way; the zoomable background has zoom_background_palette for that.
Backgrounds made from the same picture share it. The console keeps one copy of the picture in memory, and its palette is part of that copy. So this recolors every background made from the same picture that is still showing the same colors. If you need two looks at once, make two pictures with the same pixels (two tilesets with different names) and use one for each background.
backdrop = background_create(0, 0, ts_doc_dungeon);
if (backdrop != nothing) {
background_palette(backdrop, pal_doc_gold);
}A background drawn in the gold palette. The colors stay until you change them or destroy the background.
Every background takes one of the console's 16 background palettes, and backgrounds showing the same palette share one. If none is free a development build stops, and a release build leaves the background in its own colors.
A no-op on `nothing`. The palette has to have 16 colors, and the picture has to be a 16-color one: that is every picture you draw for a background in the Paint tab. A 256-color picture other than the zoomable one cannot be recolored, and a development build says so. Every background takes one of the console’s 16 background palettes, and two backgrounds with the same palette share one, so a palette you are already using somewhere else costs nothing more. If none is free a development build stops with a message that says so, and a release build leaves the background in its own colors. The colors stay on that background until you change them or destroy it. One thing the console cannot do: two backgrounds made from the same picture share their tiles and their map, and the colors belong to that shared map, so a palette set on one of them shows on every background made from that picture that is still in the picture’s own colors. To give two backgrounds different colors, make them from two different pictures (a copy of the picture with another name is enough).